/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package de.blitzcoder.collide.gui;

import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import de.blitzcoder.collide.icons.Icon;

/**
 *
 * @author blitzcoder
 */
public class IDEFrame extends JFrame {

    private boolean autoCenter = true;

    public IDEFrame() {
        super();
    }

    public IDEFrame(boolean autoCenter) {
        super();
        this.autoCenter = autoCenter;
    }

    public IDEFrame(String title) {
        super(title);
    }

    public IDEFrame(String title,boolean autoCenter) {
        super(title);
        this.autoCenter = autoCenter;
    }
    
    @Override
    public void setVisible(boolean v) {
        if (autoCenter) {
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            int width = getWidth();
            int height = getHeight();
            setLocation( screenSize.width/2-width/2 , screenSize.height/2-height/2 );
        }
        setIconImage(Icon.load("icon.png").getImage());
        super.setVisible(v);
    }
    
}
